package com.sn.author.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author xiaom
 * @Date 2020/9/22 10:04
 * @Version 1.0.0
 * @Description <>
 **/
public enum CallbackEnum {
    REGISTER_TYPE(10,"注册类型"),
    LOGIN_TYPE(20,"登录类型"),
    COLLECTION(30,"数据采集");

    @Getter
    private Integer type;

    @Getter
    private String desc;

    CallbackEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static Optional<CallbackEnum> match(Integer type) {
        return Arrays.stream(CallbackEnum.values())
                .filter(t -> t.getType().equals(type))
                .findFirst();
    }
}
